import type { Directive } from 'vue'
import { usePermission } from '@/hooks/usePermission'

export const permission: Directive = {
  mounted(el: HTMLElement, binding) {
    const { hasPermission } = usePermission()
    const { value } = binding
    if (value && !hasPermission(value)) {
      el.parentNode?.removeChild(el)
    }
  }
} 